package com.livegoods.service.impl;

import com.livegoods.pojo.House;
import com.livegoods.service.BuyActionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Service
public class BuyActionServiceImpl  implements BuyActionService {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public Map<String, Object> selectById(String id) {

        House house = mongoTemplate.findById(id, House.class);
        Date buytime = house.getBuytime();

        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("status",200);
        resultMap.put("time",buytime.getTime());

        return resultMap;
    }
}
